# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.
#
# from AUR - sligthly modified (adjusted to our style guidelines)
# Old Maintainer: Gordian Edenhofer <gordian.edenhofer@gmail.com>
# Contributor: Jonathan Liu <net147@gmail.com>

pkgname=electric-fence
pkgver=2.2.6
pkgrel=1
pkgdesc='A malloc(3) debugger that uses virtual memory hardware to detect illegal memory accesses.'
groups=('blackarch' 'blackarch-debugger')
arch=('x86_64' 'aarch64')
license=('GPL2')
url='https://packages.debian.org/sid/electric-fence'
depends=('glibc' 'bash')
source=("http://archive.ubuntu.com/ubuntu/pool/universe/e/electric-fence/electric-fence_${pkgver}.tar.gz"
        "$pkgname.sh")
sha512sums=('ba58aa854dcf0749dc0881aa7d947da878ad1f73f58a735b6bc8b04d39bebbe2f9c5c94443d57a277e7828d61fc21397605129b2ed10339263b108cbf698be42'
            '8f9c9ac510636d380c5e388c8039435dc66cd488082ef074c6fe2f512ac2a8d286b023184443b0717ef7b7abfa34061474ad59ffade0a9cd510819be5ff6d406')

build() {
	make -C $pkgname
}

package() {
	cd $pkgname

	install -Dm 755 "../$pkgname.sh" "$pkgdir/usr/bin/$pkgname"
	install -Dm 644 libefence.a "$pkgdir/usr/lib/libefence.a"
	install -Dm 755 libefence.so.0.0 "$pkgdir/usr/lib/libefence.so.0.0"
	ln -s libefence.so.0.0 "$pkgdir/usr/lib/libefence.so.0"
	ln -s libefence.so.0.0 "$pkgdir/usr/lib/libefence.so"
	install -Dm 644 libefence.3 "$pkgdir/usr/share/man/man3/libefence.3"
}

